﻿@model PagedList<Common.Background.WebManageRoles>
@{
    ViewBag.Title = "Index";
}
@Html.Partial("ContentListTag.Partial", new List<Common.Background.Models.LinkModel> { new Common.Background.Models.LinkModel("角色列表") })
<form id="sel_form">
    <table>
        <tr>
            <td>角色名称：<input type="text" name="deptName" id="deptName" style="width: 150px" />
                @Html.CreateButton("search", "搜索", ButtonType.Button, OperatorAuthority.Read)
            </td>
        </tr>
    </table>
</form>
<div id="divlist">
    <table>
        <tr>
            <th width="100"></th>
            <th>编号
            </th>
            <th>角色名称
            </th>
            <th>所属部门
            </th>
            <th>状态
            </th>
            <th>操作权限
            </th>
            <th>所属部门
            </th>
        </tr>
        <tbody>
            @if (Model != null && Model.Count() > 0)
            {
                foreach (var item1 in Model)
                {
                <tr>
                    <td>
                        @Html.AuthorityHtmlTags(OperatorAuthority.Deleted | OperatorAuthority.Read,
                    @<span>
                        @Html.ActionLink("详细", "Details", new { id = item1.ManageRoleID })
                        @Html.ActionLink("删除", "Delete", new { id = item1.ManageRoleID })
                    </span>)

                        @Html.AuthorityHtmlTags(OperatorAuthority.Modify,
                    @<span>@Html.ActionLink("编辑", "Edit", new { id = item1.ManageRoleID })</span>)
                    </td>
                    <td>
                        @item1.ManageRoleID
                    </td>
                    <td>
                        @item1.RoleName
                    </td>
                    <td>
                        @item1.WebDepartments.DepartmentName
                    </td>
                    <td>
                        @(((EntityFrameworks.Entity.Core.CommonEnums.Status)item1.Status).GetDescription())
                    </td>
                    <td>
                        @(((OperatorAuthority)item1.OperatorAuthority).GetDescription())
                    </td>
                    <td>@item1.WebDepartments.DepartmentName
                    </td>
                </tr>
                }
            }
            else
            {
                <tr>
                    <td colspan="7">没有相关信息
                    </td>
                </tr>
            }
        </tbody>
        <tfoot>
            <tr>
                <td colspan="7">@EntityFrameworks.Web.Core.Helper.PagerHelper.Pager(Html, Model)
                </td>
            </tr>
        </tfoot>
    </table>
</div>
<script type="text/javascript">
    //搜索
    $('#search').click(function () {
        $.ajax({
            type: 'GET',
            url: '/Role/Index?deptName=' + $("#deptName").val() + '&page=1',
            success: function (data) {
                $("#divlist").html(data);
            }
        });
    });
</script>
